import * as actionTypes from "./constance";
import { myEvent, myUserDetailFunc } from "@/services/myevent";

const myEventInfo = (res) => ({
  type: actionTypes.MYEVENT,
  myEvents: res,
});

const myUserDetail = (res) => ({
  type: actionTypes.MYUSERDETAILINFO,
  myUserDetailInfo: res,
});

export const myEventAction = (pagesize, lasttime) => {
  return (dispatch) => {
    myEvent(pagesize, lasttime).then((res) => {
      dispatch(myEventInfo(res));
    });
  };
};

export const myUserDetailAction = (uid) => {
  return (dispatch) => {
    myUserDetailFunc(uid).then((res) => {
      dispatch(myUserDetail(res));
    });
  };
};
